<!--{template common/header_ajax}-->
<!--{if $_GET['do']== 'getvotepost'}-->

<div class="dzzvote-container" id="dzzvote_post_$vote[voteid]" > 
  <ul class="nav nav-tabs nav-justified" role="tablist">
    <li <!--{if $vote[type]!=2}-->class="active"<!--{/if}-->><a href="#dzzvote_post_text_$vote[voteid]" role="tab" data-toggle="tab"><i class="glyphicon glyphicon-file"></i> 发起文字投票</a>
    </li>
    <li <!--{if $vote[type]==2}-->class="active"<!--{/if}-->><a href="#dzzvote_post_image_$vote[voteid]" role="tab" data-toggle="tab"><i class="glyphicon glyphicon-picture"></i> 发起图片投票</a></a>
    </li>
  </ul>
  <input type="hidden"  id="dzzvoteid_$vote[voteid]" name="voteid" value="$vote[voteid]" />
  <input type="hidden" id="dzzvotetype_$vote[voteid]" name="vote[type]" value="$vote[type]" />
  <!-- Tab panes -->
  <div class="tab-content" style="padding:20px">
    <div class="tab-pane <!--{if $vote[type]!=2}-->active<!--{/if}-->" id="dzzvote_post_text_$vote[voteid]">
      <div class="form-horizontal form-horizontal-left"  >
        <div class="form-group">
          <label class="control-label">投票标题</label>
          <div class="controls" style="padding-left:130px;float:none">
            <div class="col-xs-10" style="padding:0">
              <input type="text" class="form-control " style="width:100%"  name="vote_subject_1"   placeholder="投票标题" value="$vote['subject']" onblur="if(this.value==''){jQuery(this).addClass('input-error')}else{jQuery(this).removeClass('input-error');}">
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label "></label>
          <div class="controls" style="padding-left:130px;float:none"> <span class="help-inline">投票选项，最少2项。</span> </div>
        </div>
        <div class="dzzvote-post-item-container"> 
          <!--{if $vote[items][type_1]}--> 
          
          <!--{loop $vote[items][type_1] $key $value}-->
          
          <div class="form-group dzzvote-post-text-item">
            <label class="control-label "><span class="badge">{eval echo $key+1;}</span></label>
            <div class="controls" style="padding-left:130px;float:none">
              <div class="col-xs-10" style="padding:0">
                <input type="text" class="form-control" style="width:100%"  name="voteitem[{$value[itemid]}][content]" value="$value[content]">
                <input type="hidden"  name="voteitemnew[{$value[itemid]}][aid]" value="$value[aid]">
              </div>
              <div class="col-xs-2" ><a href="javascript:;" data-itemid="$value[itemid]" class="dzzvote-post-delitem ibtn glyphicon glyphicon-trash" ></a></div>
            </div>
          </div>
          <!--{/loop}--> 
          <!--{else}--> 
          <!--{eval for($i=1;$i<4;$i++){}-->
          <div class="form-group dzzvote-post-text-item">
            <label class="control-label "><span class="badge">$i</span></label>
            <div class="controls" style="padding-left:130px;float:none">
              <div class="col-xs-10" style="padding:0">
                <input type="text" class="form-control" style="width:100%"  name="voteitemnew[content][]" value="">
                <input type="hidden"  name="voteitemnew[aid][]" value="">
              </div>
              <div class="col-xs-2" ><a href="javascript:;" data-itemid="0" class="dzzvote-post-delitem ibtn glyphicon glyphicon-trash" ></a></div>
            </div>
          </div>
          <!--{eval }}--> 
          <!--{/if}--> 
          
        </div>
        <div class="form-group">
          <label class="control-label "></label>
          <div class="controls" style="padding-left:130px;float:none"> <a href="javascript:;" class="dzzvote-post-additem gray"><i class="ibtn glyphicon glyphicon-plus"></i> 添加选项</a> </div>
        </div>
      </div>
    </div>
    <div class="tab-pane <!--{if $vote[type]==2}-->active<!--{/if}-->" id="dzzvote_post_image_$vote[voteid]" >
      <div id="dzzvote_post_image_container_$vote[voteid]" class="dzzvote-post-image-container" style="padding:10px;">
        <div class="form-group">
          <label class="control-label">投票标题</label>
          <div class="controls" style="padding-left:130px;float:none">
            <div class="col-xs-10" style="padding:0">
              <input type="text" class="form-control " style="width:100%"  name="vote_subject_2"   placeholder="投票标题" value="$vote['subject']"  onblur="if(this.value==''){jQuery(this).addClass('input-error')}else{jQuery(this).removeClass('input-error');}">
            </div>
          </div>
        </div>
        <div class="dzzvote-post-image-header clearfix" style="padding:10px 10px;padding-left:50px;">
          <div class="pull-left" style="position:relative;overflow:hidden">
            <button class="btn btn-simple" onclick="return false;">上传投票图片</button>
            <input id="dzzvote_post_image_upload_$vote[voteid]" name="dzzvotefiles[]" tabindex="-1" style="position: absolute;outline:none;display:none; filter: alpha(opacity=0); PADDING-BOTTOM: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font-family: Arial; font-size: 180px;height:40px;width:100%;top: 0px; cursor: pointer; right: 0px; padding-top: 0px; opacity: 0;direction:ltr;background-image:none" type="file" multiple="">
          </div>
          <div class="pull-left ml20">
            <button class="btn btn-simple needindzz" onclick="dzzvote_uploadfrom_desktop();return false" >从桌面选择</button>
          </div>
          <span class="help-inline">上传的每张图片作为每条投票，也可以把图片拖放到该区域,点击图片下方的名称，修改图片投票项的说明</span> </div>
        <div class="dzzvote-post-item-container clearfix" > 
          <!--{loop $vote[items][type_2] $value}-->
          <div class="dzzvote-post-image-item"> <a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="$value['itemid']" class="dzzvote-post-delitem" ><i class="ibtn glyphicon glyphicon-trash"></i></a>
            <div class="thumbnail"> 
              <div class="text-center"> <a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" alt="$value['content']"></a></div>
              <div class="caption text-center" style="">
                <input type="text" class="form-control input-image-title" name="voteitem[{$value[itemid]}][content]" value="$value[content]" />
                <input type="hidden" name="voteitem[{$value[itemid]}][aid]" value="$value[aid]" />
              </div>
            </div>
          </div>
          <!--{/loop}--> 
        </div>
      </div>
    </div>
    <div class="form-group">
      <label class="control-label">投票选项</label>
      <select id="dzzvote_maxselect_num_$vote[voteid]" name="vote[maxselectnum]" class="form-control">
        <!--{if $vote[voteid] && $vote['items']['type_'.$vote[type]]}--> 
        <!--{loop $vote['items']['type_'.$vote[type]] $key $value}-->
                            	{eval $i=$key+1};
                                <option value="$i" <!--{if $vote[maxselectnum]==$i}-->selected="selected"<!--{/if}-->>最多可选择 $i 项
        </option>
        <!--{/loop}--> 
        <!--{else}-->
        <option value="1">最多可选择 1 项</option>
        <option value="2">最多可选择 2 项</option>
        <option value="3">最多可选择 3 项</option>
        <!--{/if}-->
      </select>
    </div>
    <div class="form-group ">
      <label class="control-label">截止时间</label>
      <select class="form-control" onchange="if(this.value){jQuery('#dzzvote_endtime_$vote[voteid]').datepicker('setDate',this.value)}else{jQuery('#dzzvote_endtime_$vote[voteid]').val('')}" style="width:100px;">
        <option value="" selected="">无限制</option>
        <option value="now" <!--{if $vote[endtime]}-->selected="selected"<!--{/if}-->>自定义
        </option>
        <option value="7">一周</option>
        <option value="1 month">一个月</option>
        <option value="6 month">半年</option>
        <option value="12 month">一年</option>
      </select>
      <input type="text" id="dzzvote_endtime_$vote[voteid]" name="vote[endtime]" class="form-control ml20" style="width:100px;" value="$vote[endtime]" />
      <span class="help-inline">留空，无结束时间；点击输入框可以自定义时间</span> </div>
    <div class="form-group">
      <label class="control-label">投票结果</label>
      <div class="controls ">
        <label class="radio radio-inline">
          <input type="radio" name="vote[isvisible]" value="1" checked="checked">
          投票后可见</label>
        <label class="radio radio-inline"><input type="radio" name="vote[isvisible]" value="0" <!--{if isset($vote[invisible]) && $vote[invisible]<1}-->checked="checked"<!--{/if}-->>任何人可见</label>
      </div>
    </div>
     <div class="form-group">
      <label class="control-label">投票用户</label>
      <div class="controls ">
        <label class="radio-inline"> <input type="radio" name="vote[showuser]" value="0" checked="checked">不显示</label>
        <label class="radio-inline"><input type="radio" name="vote[showuser]" value="1" <!--{if $vote[showuser]}-->checked="checked"<!--{/if}-->>显示</label>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript" reload="1">
  
	jQuery(document).ready(function(e) {
		    jQuery('#dzzvote_post_{$vote[voteid]}').find('a[href="#dzzvote_post_text_{$vote[voteid]}"]').on('shown.bs.tab', function (e) {
			   jQuery('#dzzvotetype_{$vote[voteid]}').val(1);
			});
			jQuery('#dzzvote_post_{$vote[voteid]}').find('a[href="#dzzvote_post_image_{$vote[voteid]}"]').on('shown.bs.tab', function (e) {
			   jQuery('#dzzvotetype_{$vote[voteid]}').val(2);
			});
         jcLoader().load({type:'css',ids:'css_vote,css_datepicker',url:'./dzz/dzzvote/images/vote.css?{VERHASH},./dzz/dzzvote/images/datepicker.css?{VERHASH}'});
	
	 	jcLoader().load({type:"js",ids:'js_ui_core,js_datepicker,js_dzzvote',url:"static/js/jquery.ui.core.js?{VERHASH},static/js/datepicker/jquery.ui.datepicker.min.js?{VERHASH},dzz/dzzvote/scripts/jquery.dzzvote.js"},function(){
			 jQuery('#dzzvote_post_{$vote[voteid]}').dzzvote({voteid:'$vote[voteid]'});
			 jQuery('#dzzvote_post_image_upload_{$vote[voteid]}').show();
			 jQuery('#dzzvote_endtime_{$vote[voteid]}').datepicker();
		}); 
		 jQuery('#dzzvote_post_image_upload_{$vote[voteid]}').fileupload({
				url: '{DZZSCRIPT}?mod=dzzvote&op=ajax&do=imageUpload',
				dataType: 'json',
				autoUpload: true,
				paramName:'dzzvotefiles[]',
				maxFileSize: 2000000, // 2 MB
				maxChunkSize:2000000, //2M
				acceptFileTypes:new RegExp("\.(gif|jpe?g|png)$",'i'),
				dropZone:jQuery('#dzzvote_post_image_container_{$vote[voteid]}'),
				pasteZone:jQuery('#dzzvote_post_image_container_{$vote[voteid]}'),
				sequentialUploads:true,
				add:function(e,data){
					 data.context = jQuery('<div class="dzzvote-post-image-item"></div>');
					 jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-item-container').append(data.context);
					
					jQuery.each(data.files, function (index, file) {
						if(!file.name) file.name='clipboardData.png';
						var html='';
							html+='  <a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="0" class="dzzvote-post-delitem" ><i class="ibtn glyphicon glyphicon-trash"></i></a>';
							html+=' <div class="thumbnail">';
							html+='		<img  src="dzz/images/default/upload_failure.png">';
							html+='    <div class="caption text-center">';
							html+='      <div class="progress-container" >';
							html+='  		  <div class="progress active" style="margin:0;" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">';
							html+='            	<div class="progress-bar progress-bar-success" style="width:0%;"></div>';
							html+='           </div>';
							html+='       </div>';
							html+='    </div>';
							html+=' </div>';
						jQuery(html).appendTo(data.context);
					});
					data.process().done(function () {
						data.submit();
					});
					
				},
				progress: function (e,data){
					 var index = 0;//data.index,
					 var  node = jQuery(data.context.children()[index]);
					 var progress = parseInt(data.loaded / data.total * 100, 10);
					 node.find('.progress-bar').css(
						'width',
						progress + '%'
					 );
				},
				done: function (e, data) {
					jQuery.each(data.result.dzzvotefiles, function (index, file) {
						if(file.error){
							data.context.find('.progress-container').replaceWith('<span class="text-danger">'+file.error+'</span>');
						}else{
							var html='<input type="text" class="form-control input-image-title" name="voteitemnew[content][]" value="'+file.data.filename.replace(/\.(gif|jpe?g|png)$/i,'')+'" /><input type="hidden" name="voteitemnew[aid][]" value="'+file.data.aid+'" />';
							data.context.find('img').attr('src',file.data.img).end().find('.progress-container').replaceWith(html);
							dzzvote_maxselect_num();
							
						}
					});
				}
			});
		 
    });
	function dzzvote_maxselect_num(){
			var val=parseInt(jQuery('#dzzvote_maxselect_num_{$vote[voteid]}').val());
			if(jQuery('#dzzvotetype_{$vote[voteid]}').val()>1){
				var sum=jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-image-item').length;
			}else{
				var sum=jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-text-item').length;
			}
			var option='';
			for(var i=1 ;i<=sum; i++){
				if(i==val){
					option+='<option value="'+i+'" checked="checked">最多可选择 '+i+' 项</option>';
				}else{
					option+='<option value="'+i+'">最多可选择 '+i+' 项</option>';
				}
			}
			jQuery('#dzzvote_maxselect_num_{$vote[voteid]}').html(option);
		}
	function dzzvote_uploadfrom_desktop(){
			if(!top._config) return;
			top.OpenFile('open','打开文件',{image:['图像(*.jpg,*.jpeg,*.png,*.gif)',['IMAGE','JPG','JPEG','PNG','GIF'],'selected']},{multiple:true},function(data){//只打开本地盘
				var datas=[];
				if(data.params.multiple){
					datas=data.icodata
				}else{
					datas=[data.icodata];
				}
				var html='';
				for(var i in datas){
					if(datas[i].type=='image'){
						var img=DZZSCRIPT+'?mod=io&op=thumbnail&width=240&height=160&path='+(datas[i].apath?datas[i].apath:datas[i].dpath);
						html+='<div class="dzzvote-post-image-item">';
						html+='  <a href="javascript:;" style="position:absolute;right:15px;top:15px;" data-itemid="0" class="dzzvote-post-delitem" ><i class="ibtn glyphicon glyphicon-trash"></i></a>';
						html+='  <div class="thumbnail">';
						html+='		<img  src="'+img+'">';
						html+='     <div class="caption text-center">';
						html+='  		  <input type="text" class="form-control input-image-title" name="voteitemnew[content][]" value="'+datas[i].name.replace(/\.(gif|jpe?g|png)$/i,'')+'">';
						html+='           <input type="hidden" name="voteitemnew[aid][]" value="'+datas[i].aid+'">';
						html+='     </div>';
						html+='   </div>';
						html+='</div>';
					}
				}
				if(html!=''){
					 jQuery('#dzzvote_post_image_container_{$vote[voteid]} .dzzvote-post-item-container').append(html);
				}
			});
		}	
	</script> 
<!--{elseif $_GET['do']=='getvote'}-->

<div id="dzzvote_$vote[voteid]" class="dzzvote dzzvote-text">
  <div class="dzzvote-header clearfix">
    <div class="pull-left">
      <div class="dzzvote-header-plate"> <span class="plate-title">参与人数</span> <em class="voter-num ">$votesum</em> </div>
    </div>
    <div class="dzzvote-header-body">
      <h4 class="dzzvote-subject">$vote[subject]</h4>
      <div class="dzzvote-info">$endtime | 最多选择 $vote['maxselectnum'] 项</div>
    </div>
  </div>
  <!--{if $status>0}-->
  <div class="dzzvote-body" id="vote_text_$vote[voteid]"> 
    <!--{if $vote[type]==1}--> 
    <!--{loop $vote['items']['type_1'] $value}-->
    <div class="form-group clearfix">
      <div class="col-sm-8 checkbox"> $value[content] </div>
      <div class="col-sm-4">
        <div class="progress">
          <div class="progress-bar  progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
        </div>
      </div>
    </div>
    <!--{/loop}--> 
    <!--{else}-->
    <div class="dzzvote-image-body clearfix"> 
      <!--{loop $vote['items']['type_2'] $value}-->
      <div class="dzzvote-image-item noactive hasprogress">
        <div class="thumbnail">
         <div class="text-center"> <a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" title="$value['content']"></a></div>
          <div class="caption text-center" style="">
            <div class="progress">
              <div class="progress-bar  progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
            </div>
            <div class="content">$value['content']</div>
          </div>
        </div>
      </div>
      <!--{/loop}--> 
    </div>
    <!--{/if}--> 
    
  </div>
   <!--{if $status==1}-->
   <div class="dzzvote-footer "> 
   <span class="success">您已经投过票，谢谢您的参与</span> 
    
  </div>
  <!--{/if}--> 
  
  <!--{else}-->
  <form id="voteform_$vote[voteid]" name="voteform"  action="{DZZSCRIPT}?mod=dzzvote&op=ajax&do=itemvote" method="post" style="margin:0" onsubmit="validate_{$vote[voteid]}(this);return false" >
    <input type="hidden" name="votesubmit" value="true" />
    <input type="hidden" name="handlekey" value="dzzvote_{$vote[voteid]}" />
    <input type="hidden" name="formhash" value="{FORMHASH}" />
    <div class="dzzvote-body" id="vote_text_$vote[voteid]">
    <!--{if $vote[type]==1}--> 
    <!--{loop $vote['items']['type_1'] $value}-->
    <div class="form-group clearfix"> 
      <!--{if $vote['isvisible']>0}-->
      <div class="checkbox">
        <label>
          <input type="checkbox" id="item_$value[itemid]"  name="vote[]" value="$value[itemid]" >
          $value[content] </label>
      </div>
      <!--{else}-->
      <div class="col-sm-8 checkbox">
        <label>
          <input type="checkbox" id="item_$value[itemid]"  name="vote[]" value="$value[itemid]" >
          $value[content] </label>
      </div>
      <div class="col-sm-4">
        <div class="progress">
          <div class="progress-bar  progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
        </div>
      </div>
      <!--{/if}--> 
    </div>
    
    <!--{/loop}--> 
    <!--{else}-->
    <div class="dzzvote-image-body clearfix"> 
      <!--{loop $vote['items']['type_2'] $value}--> 
      
      <!--{if $vote['isvisible']>0}-->
      <div id="item_$value[itemid]" data-itemid="$value[itemid]" class="dzzvote-image-item " >
        <div style="position:absolute;right:15px;top:15px;" ><i class="ibtn glyphicon glyphicon-ok"></i></div>
        <div class="thumbnail">
         <div class="text-center"> <a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" title="$value['content']"></a></div>
          <div class="caption text-center" style="">
            <div class="content">$value['content']</div>
          </div>
        </div>
      </div>
      <!--{else}-->
      <div id="item_$value[itemid]" data-itemid="$value[itemid]" class="dzzvote-image-item hasprogress">
        <div style="position:absolute;right:15px;top:15px;" ><i class="ibtn glyphicon glyphicon-ok"></i></div>
        <div class="thumbnail"> 
           <div class="text-center"> <a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" title="$value['content']"></a></div>
          <div class="caption text-center" style="">
            <div class="progress">
              <div class="progress-bar progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
            </div>
            <div class="content">$value['content']</div>
          </div>
        </div>
       </div>
        <!--{/if}--> 
        <!--{/loop}--> 
      </div>
      <!--{/if}--> 
    </div>
   
    <div class="dzzvote-footer">
      <button id="votesubmit_btn_$vote[voteid]" class="btn btn-primary ml20" style="padding:6px 25px;" data-loading-text="投票中...">投票</button>
      <small id="error_msg"  style="color:red;padding:0 10px;line-height:30px;"></small> </div>
  </form>
  <!--{/if}--> 
  <!--{if $vote[showuser]}-->
  <div id="voteuser_{$vote[voteid]}" class="dzzvote-user clearfix">
     <script type="text/javascript" reload="1">jQuery('#voteuser_{$vote[voteid]}').load('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteuser&voteid=$vote[voteid]&page=1');</script>
  </div>
  <!--{/if}--> 
</div>

<script type="text/javascript">

	var maxselectnum_{$vote[voteid]}=parseInt('$vote[maxselectnum]');
	var checkarr_{$vote[voteid]}=[];
		jcLoader().load({type:'css',url:'./dzz/dzzvote/images/vote.css?{VERHASH},static/icheck/skins/minimal/blue.css?{VERHASH}'});
		jcLoader().load({type:'js',url:'static/icheck/icheck.min.js?{VERHASH}'},function(){
			jQuery('#dzzvote_{$vote[voteid]} input').iCheck({
				  checkboxClass: 'icheckbox_minimal-blue',
				  radioClass: 'iradio_minimal-blue',
			});
			
			jQuery('#dzzvote_{$vote[voteid]} input').on('ifChecked',function(e){
				if(checkarr_{$vote[voteid]}.length>=maxselectnum_{$vote[voteid]}){
					jQuery('#'+checkarr_{$vote[voteid]}.pop()).iCheck('uncheck');
				}
				checkarr_{$vote[voteid]}.push(this.id);
			});
			jQuery('#dzzvote_{$vote[voteid]} input').on('ifUnchecked',function(e){
				var i=jQuery.inArray(this.id,checkarr_{$vote[voteid]});
				if(i>-1) checkarr_{$vote[voteid]}.splice(i,1);
			});
			jQuery('#dzzvote_{$vote[voteid]} .dzzvote-image-item:not(.noactive)').on('click',function(){
				
				if(jQuery(this).hasClass('active')){
					var i=jQuery.inArray(this.id,checkarr_{$vote[voteid]});
					if(i>-1) checkarr_{$vote[voteid]}.splice(i,1);
					jQuery(this).removeClass('active');
					jQuery(this).find('input[type=hidden]').remove();
					
				}else{
					if(checkarr_{$vote[voteid]}.length>=maxselectnum_{$vote[voteid]}){
						var oldid= checkarr_{$vote[voteid]}.pop();
						var i=jQuery.inArray(oldid,checkarr_{$vote[voteid]});
						if(i>-1) checkarr_{$vote[voteid]}.splice(i,1);
						jQuery('#'+oldid).removeClass('active');
						jQuery('#'+oldid).find('input[type=hidden]').remove();
					}
					checkarr_{$vote[voteid]}.push(this.id);
					jQuery(this).addClass('active');
					jQuery('<input type="hidden" name="vote[]" value="'+jQuery(this).data('itemid')+'" />').appendTo(this);
				}	
				
				
			});
			
		});
 function validate_$vote[voteid](form){
	 if(checkarr_{$vote[voteid]}.length<1) {
		  showmessage('请选择投票项目','danger',3000,1);
		  return false;
	 }
	 jQuery('#votesubmit_btn_$vote[voteid]').button('loading');
	 ajaxpost(form.id,'votesubmit_btn_$vote[voteid]','votesubmit_btn_$vote[voteid]');
 }
 function succeedhandle_dzzvote_{$vote[voteid]}(url, message, values) {
	 ajaxget('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteresult&voteid=$vote[voteid]','dzzvote_$vote[voteid]','dzzvote_$vote[voteid]');
 };
</script> 

     
<!--{elseif $_GET['do']=='getvoteresult'}-->
<div class="dzzvote-header clearfix">
  <div class="pull-left">
    <div class="dzzvote-header-plate"> <span class="plate-title">参与人数</span> <em id="voter_num">$votesum</em> </div>
  </div>
  <div class="dzzvote-header-body">
    <h4 class="dzzvote-subject">$vote[subject]</h4>
    <div class="dzzvote-info">$endtime | 最多选择 $vote['maxselectnum'] 项</div>
  </div>
</div>
<div class="dzzvote-body" id="vote_text_$vote[voteid]"> 
  <!--{if $vote[type]==1}--> 
  <!--{loop $vote['items']['type_1'] $value}-->
  <div class="form-group clearfix">
    <div class="col-sm-8 checkbox"> $value[content] </div>
    <div class="col-sm-4">
      <div class="progress">
        <div class="progress-bar progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
      </div>
    </div>
  </div>
  <!--{/loop}--> 
  <!--{else}-->
  <div class="dzzvote-image-body clearfix"> 
    <!--{loop $vote['items']['type_2'] $value}-->
    <div class="dzzvote-image-item hasprogress">
      <div class="thumbnail"> 
       <div class="text-center"> <a style="display:inline-block" href="$value[url]" target="_blank"><img src="$value[img]" title="$value['content']"></a></div>
        <div class="caption text-center" style="">
          <div class="progress">
            <div class="progress-bar progress-bar-success"  role="progressbar"  aria-valuenow="{eval echo floor(($value[number]/$votetotal)*100);}" aria-valuemin="0" aria-valuemax="100" style="width: {eval echo floor(($value[number]/$votetotal)*100);}%;min-width: 20px;"> {eval echo floor(($value[number]/$votetotal)*100);}% </div>
          </div>
          <div class="content">$value['content']</div>
        </div>
      </div>
    </div>
    <!--{/loop}--> 
  </div>
  <!--{/if}--> 
</div>
<div class="dzzvote-footer"><span class="success">您已经投过票，谢谢您的参与</span></div>
<!--{if $vote[showuser]}-->
  <div id="voteuser_{$vote[voteid]}" class="dzzvote-user clearfix">
     <script type="text/javascript" reload="1">jQuery('#voteuser_{$vote[voteid]}').load('{DZZSCRIPT}?mod=dzzvote&op=ajax&do=getvoteuser&voteid=$vote[voteid]&page=1');</script>
  </div>
  <!--{/if}--> 

<!--{/if}--> 
<!--{template common/footer_ajax}--> 
